using System.ComponentModel.DataAnnotations;

namespace Gateway.IApplication.Role.Input;
/// <summary>
/// 
/// </summary>
public class SetMenusAndPermissionInput  : IValidatableObject
{
    /// <summary>
    /// 
    /// </summary>
    public string RoleId { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public List<RoleMenuInput> Menus { get; set; }

    /// <summary>
    /// 权限
    /// </summary>
    public List<RoleExtensionPermissionInput> Permissions { get; set; }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="validationContext"></param>
    /// <returns></returns>
    public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
    {
        if (Menus?.Count <= 0 || Permissions?.Count <= 0)
        {
            yield return new ValidationResult("至少选择一种权限！");
        }
        
    }
}